home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / centiped.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  24KB  |  578 lines

  1. /***************************************************************************
  2.  
  3. Main clock: XTAL = 12.096 MHz
  4. 6502 Clock: XTAL/8 = 1.512 MHz (0.756 when accessing playfield RAM)
  5. Horizontal video frequency: HSYNC = XTAL/256/3 = 15.75 kHz
  6. Video frequency: VSYNC = HSYNC/263 ?? = 59.88593 Hz (not sure, could be /262)
  7. VBlank duration: 1/VSYNC * (23/263) = 1460 us
  8.  
  9.  
  10.               Centipede Memory map and Dip Switches
  11.               -------------------------------------
  12.  
  13. Memory map for Centipede directly from the Atari schematics (1981).
  14.  
  15.  Address  R/W  D7 D6 D5 D4 D3 D2 D1 D0   Function
  16. --------------------------------------------------------------------------------------
  17. 0000-03FF       D  D  D  D  D  D  D  D   RAM
  18. --------------------------------------------------------------------------------------
  19. 0400-07BF       D  D  D  D  D  D  D  D   Playfield RAM
  20. 07C0-07CF       D  D  D  D  D  D  D  D   Motion Object Picture
  21. 07D0-07DF       D  D  D  D  D  D  D  D   Motion Object Vert.
  22. 07E0-07EF       D  D  D  D  D  D  D  D   Motion Object Horiz.
  23. 07F0-07FF             D  D  D  D  D  D   Motion Object Color
  24. --------------------------------------------------------------------------------------
  25. 0800       R    D  D  D  D  D  D  D  D   Option Switch 1 (0 = On)
  26. 0801       R    D  D  D  D  D  D  D  D   Option Switch 2 (0 = On)
  27. --------------------------------------------------------------------------------------
  28. 0C00       R    D           D  D  D  D   Horizontal Mini-Track Ball tm Inputs
  29.            R       D                     VBLANK  (1 = VBlank)
  30.            R          D                  Self-Test  (0 = On)
  31.            R             D               Cocktail Cabinet  (1 = Cocktail)
  32. 0C01       R    D  D  D                  R,C,L Coin Switches (0 = On)
  33.            R             D               SLAM  (0 = On)
  34.            R                D            Player 2 Fire Switch (0 = On)
  35.            R                   D         Player 1 Fire Switch (0 = On)
  36.            R                      D      Player 2 Start Switch (0 = On)
  37.            R                         D   Player 1 Start Switch (0 = On)
  38.  
  39. 0C02       R    D           D  D  D  D   Vertical Mini-Track Ball tm Inputs
  40. 0C03       R    D  D  D  D               Player 1 Joystick (R,L,Down,Up)
  41.            R                D  D  D  D   Player 2 Joystick   (0 = On)
  42. --------------------------------------------------------------------------------------
  43. 1000-100F R/W   D  D  D  D  D  D  D  D   Custom Audio Chip
  44. 1404       W                D  D  D  D   Playfield Color RAM
  45. 140C       W                D  D  D  D   Motion Object Color RAM
  46. --------------------------------------------------------------------------------------
  47. 1600       W    D  D  D  D  D  D  D  D   EA ROM Address & Data Latch
  48. 1680       W                D  D  D  D   EA ROM Control Latch
  49. 1700       R    D  D  D  D  D  D  D  D   EA ROM Read Data
  50. --------------------------------------------------------------------------------------
  51. 1800       W                             IRQ Acknowledge
  52. --------------------------------------------------------------------------------------
  53. 1C00       W    D                        Left Coin Counter (1 = On)
  54. 1C01       W    D                        Center Coin Counter (1 = On)
  55. 1C02       W    D                        Right Coin Counter (1 = On)
  56. 1C03       W    D                        Player 1 Start LED (0 = On)
  57. 1C04       W    D                        Player 2 Start LED (0 = On)
  58. 1C07       W    D                        Track Ball Flip Control (0 = Player 1)
  59. --------------------------------------------------------------------------------------
  60. 2000       W                             WATCHDOG
  61. 2400       W                             Clear Mini-Track Ball Counters
  62. --------------------------------------------------------------------------------------
  63. 2000-3FFF  R                             Program ROM
  64. --------------------------------------------------------------------------------------
  65.  
  66. -EA ROM is an Erasable Reprogrammable rom to save the top 3 high scores
  67.   and other stuff.
  68.  
  69.  
  70.  Dip switches at N9 on the PCB
  71.  
  72.  8    7    6    5    4    3    2    1    Option
  73. -------------------------------------------------------------------------------------
  74.                               On   On    English $
  75.                               On   Off   German
  76.                               Off  On    French
  77.                               Off  Off   Spanish
  78. -------------------------------------------------------------------------------------
  79.                     On   On              2 lives per game
  80.                     On   Off             3 lives per game $
  81.                     Off  On              4 lives per game
  82.                     Off  Off             5 lives per game
  83. -------------------------------------------------------------------------------------
  84.                                          Bonus life granted at every:
  85.           On   On                        10,000 points
  86.           On   Off                       12.000 points $
  87.           Off  On                        15,000 points
  88.           Off  Off                       20,000 points
  89. -------------------------------------------------------------------------------------
  90.      On                                  Hard game difficulty
  91.      Off                                 Easy game difficulty $
  92. -------------------------------------------------------------------------------------
  93. On                                       1-credit minimum $
  94. Off                                      2-credit minimum
  95. -------------------------------------------------------------------------------------
  96.  
  97. $ = Manufacturer's suggested settings
  98.  
  99.  
  100.  Dip switches at N8 on the PCB
  101.  
  102.  8    7    6    5    4    3    2    1    Option
  103. -------------------------------------------------------------------------------------
  104.                               On   On    Free play
  105.                               On   Off   1 coin for 2 credits
  106.                               Off  On    1 coin for 1 credit $
  107.                               Off  Off   2 coins for 1 credit
  108. -------------------------------------------------------------------------------------
  109.                     On   On              Right coin mech X 1 $
  110.                     On   Off             Right coin mech X 4
  111.                     Off  On              Right coin mech X 5
  112.                     Off  Off             Right coin mech X 6
  113. -------------------------------------------------------------------------------------
  114.                On                        Left coin mech X 1 $
  115.                Off                       Left coin mech X 2
  116. -------------------------------------------------------------------------------------
  117. On   On   On                             No bonus coins $
  118. On   On   Off                            For every 2 coins inserted, game logic
  119.                                           adds 1 more coin
  120. On   Off  On                             For every 4 coins inserted, game logic
  121.                                           adds 1 more coin
  122. On   Off  Off                            For every 4 coins inserted, game logic
  123.                                           adds 2 more coin
  124. Off  On   On                             For every 5 coins inserted, game logic
  125.                                           adds 1 more coin
  126. Off  On   Off                            For every 3 coins inserted, game logic
  127.                                           adds 1 more coin
  128. -------------------------------------------------------------------------------------
  129. $ = Manufacturer's suggested settings
  130.  
  131. Changes:
  132.     30 Apr 98 LBO
  133.     * Fixed test mode
  134.     * Changed high score to use earom routines
  135.     * Added support for alternate rom set
  136.  
  137. Known issues:
  138.  
  139. * Are coins supposed to take over a second to register?
  140. * Need to confirm CPU and Pokey clocks
  141.  
  142. ***************************************************************************/
  143.  
  144. #include "driver.h"
  145. #include "vidhrdw/generic.h"
  146. #include "machine/atari_vg.h"
  147.  
  148.  
  149. READ_HANDLER( centiped_IN0_r );
  150. READ_HANDLER( centiped_IN2_r );    /* JB 971220 */
  151.  
  152. WRITE_HANDLER( centiped_paletteram_w );
  153. WRITE_HANDLER( centiped_vh_flipscreen_w );
  154. void centiped_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  155.  
  156. void centiped_init_machine(void);    /* in vidhrdw */
  157. int centiped_interrupt(void);    /* in vidhrdw */
  158.  
  159.  
  160.  
  161. static WRITE_HANDLER( centiped_led_w )
  162. {
  163.     osd_led_w(offset,~data >> 7);
  164. }
  165.  
  166. static READ_HANDLER( centipdb_rand_r )
  167. {
  168.     return rand() % 0xff;
  169. }
  170.  
  171. static WRITE_HANDLER( centipdb_AY8910_w )
  172. {
  173.     AY8910_control_port_0_w(0, offset);
  174.     AY8910_write_port_0_w(0, data);
  175. }
  176.  
  177. static READ_HANDLER( centipdb_AY8910_r )
  178. {
  179.     AY8910_control_port_0_w(0, offset);
  180.     return AY8910_read_port_0_r(0);
  181. }
  182.  
  183. static struct MemoryReadAddress centiped_readmem[] =
  184. {
  185.     { 0x0000, 0x03ff, MRA_RAM },
  186.     { 0x0400, 0x07ff, MRA_RAM },
  187.     { 0x0800, 0x0800, input_port_4_r },    /* DSW1 */
  188.     { 0x0801, 0x0801, input_port_5_r },    /* DSW2 */
  189.     { 0x0c00, 0x0c00, centiped_IN0_r },    /* IN0 */
  190.     { 0x0c01, 0x0c01, input_port_1_r },    /* IN1 */
  191.     { 0x0c02, 0x0c02, centiped_IN2_r },    /* IN2 */    /* JB 971220 */
  192.     { 0x0c03, 0x0c03, input_port_3_r },    /* IN3 */
  193.     { 0x1000, 0x100f, pokey1_r },
  194.     { 0x1700, 0x173f, atari_vg_earom_r },
  195.     { 0x2000, 0x3fff, MRA_ROM },
  196.     { 0xf800, 0xffff, MRA_ROM },    /* for the reset / interrupt vectors */
  197.     { -1 }    /* end of table */
  198. };
  199.  
  200. /* Same as the regular one, except it uses an AY8910 and an external RNG */
  201. static struct MemoryReadAddress centipdb_readmem[] =
  202. {
  203.     { 0x0000, 0x03ff, MRA_RAM },
  204.     { 0x0400, 0x07ff, MRA_RAM },
  205.     { 0x0800, 0x0800, input_port_4_r },    /* DSW1 */
  206.     { 0x0801, 0x0801, input_port_5_r },    /* DSW2 */
  207.     { 0x0c00, 0x0c00, centiped_IN0_r },    /* IN0 */
  208.     { 0x0c01, 0x0c01, input_port_1_r },    /* IN1 */
  209.     { 0x0c02, 0x0c02, centiped_IN2_r },    /* IN2 */    /* JB 971220 */
  210.     { 0x0c03, 0x0c03, input_port_3_r },    /* IN3 */
  211.     { 0x1000, 0x100f, centipdb_AY8910_r },
  212.     { 0x1700, 0x173f, atari_vg_earom_r },
  213.     { 0x1780, 0x1780, centipdb_rand_r },
  214.     { 0x2000, 0x3fff, MRA_ROM },
  215.     { 0xf800, 0xffff, MRA_ROM },    /* for the reset / interrupt vectors */
  216.     { -1 }    /* end of table */
  217. };
  218.  
  219. static struct MemoryReadAddress centipb2_readmem[] =
  220. {
  221.     { 0x0000, 0x03ff, MRA_RAM },
  222.     { 0x0400, 0x07ff, MRA_RAM },
  223.     { 0x0800, 0x0800, input_port_4_r },    /* DSW1 */
  224.     { 0x0801, 0x0801, input_port_5_r },    /* DSW2 */
  225.     { 0x0c00, 0x0c00, centiped_IN0_r },    /* IN0 */
  226.     { 0x0c01, 0x0c01, input_port_1_r },    /* IN1 */
  227.     { 0x0c02, 0x0c02, centiped_IN2_r },    /* IN2 */    /* JB 971220 */
  228.     { 0x0c03, 0x0c03, input_port_3_r },    /* IN3 */
  229.     { 0x1001, 0x1001, AY8910_read_port_0_r },
  230.     { 0x1700, 0x173f, atari_vg_earom_r },
  231.     { 0x2000, 0x3fff, MRA_ROM },
  232.     { 0x6000, 0x67ff, MRA_ROM },
  233.     { 0xf800, 0xffff, MRA_ROM },    /* for the reset / interrupt vectors */
  234.     { -1 }    /* end of table */
  235. };
  236.  
  237. static struct MemoryWriteAddress centiped_writemem[] =
  238. {
  239.     { 0x0000, 0x03ff, MWA_RAM },
  240.     { 0x0400, 0x07bf, videoram_w, &videoram, &videoram_size },
  241.     { 0x07c0, 0x07ff, MWA_RAM, &spriteram },
  242.     { 0x1000, 0x100f, pokey1_w },
  243.     { 0x1400, 0x140f, centiped_paletteram_w, &paletteram },
  244.     { 0x1600, 0x163f, atari_vg_earom_w },
  245.     { 0x1680, 0x1680, atari_vg_earom_ctrl_w },
  246.     { 0x1800, 0x1800, MWA_NOP },    /* IRQ acknowldege */
  247.     { 0x1c00, 0x1c02, coin_counter_w },
  248.     { 0x1c03, 0x1c04, centiped_led_w },
  249.     { 0x1c07, 0x1c07, centiped_vh_flipscreen_w },
  250.     { 0x2000, 0x2000, watchdog_reset_w },
  251.     { 0x2000, 0x3fff, MWA_ROM },
  252.     { -1 }    /* end of table */
  253. };
  254.  
  255. /* Same as the regular one, except it uses an AY8910 */
  256. static struct MemoryWriteAddress centipdb_writemem[] =
  257. {
  258.     { 0x0000, 0x03ff, MWA_RAM },
  259.     { 0x0400, 0x07bf, videoram_w, &videoram, &videoram_size },
  260.     { 0x07c0, 0x07ff, MWA_RAM, &spriteram },
  261.     { 0x1000, 0x100f, centipdb_AY8910_w },
  262.     { 0x1400, 0x140f, centiped_paletteram_w, &paletteram },
  263.     { 0x1600, 0x163f, atari_vg_earom_w },
  264.     { 0x1680, 0x1680, atari_vg_earom_ctrl_w },
  265.     { 0x1800, 0x1800, MWA_NOP },    /* IRQ acknowldege */
  266.     { 0x1c00, 0x1c02, coin_counter_w },
  267.     { 0x1c03, 0x1c04, centiped_led_w },
  268.     { 0x1c07, 0x1c07, centiped_vh_flipscreen_w },
  269.     { 0x2000, 0x2000, watchdog_reset_w },
  270.     { 0x2000, 0x3fff, MWA_ROM },
  271.     { -1 }    /* end of table */
  272. };
  273.  
  274. static struct MemoryWriteAddress centipb2_writemem[] =
  275. {
  276.     { 0x0000, 0x03ff, MWA_RAM },
  277.     { 0x0400, 0x07bf, videoram_w, &videoram, &videoram_size },
  278.     { 0x07c0, 0x07ff, MWA_RAM, &spriteram },
  279.     { 0x1000, 0x1000, AY8910_write_port_0_w },
  280.     { 0x1001, 0x1001, AY8910_control_port_0_w },
  281.     { 0x1400, 0x140f, centiped_paletteram_w, &paletteram },
  282.     { 0x1600, 0x163f, atari_vg_earom_w },
  283.     { 0x1680, 0x1680, atari_vg_earom_ctrl_w },
  284.     { 0x1800, 0x1800, MWA_NOP },    /* IRQ acknowldege */
  285.     { 0x1c00, 0x1c02, coin_counter_w },
  286.     { 0x1c03, 0x1c04, centiped_led_w },
  287.     { 0x1c07, 0x1c07, centiped_vh_flipscreen_w },
  288.     { 0x2000, 0x2000, watchdog_reset_w },
  289.     { 0x2000, 0x3fff, MWA_ROM },
  290.     { 0x6000, 0x67ff, MWA_ROM },
  291.     { -1 }    /* end of table */
  292. };
  293.  
  294.  
  295. /* The input ports are identical for the real one and the bootleg one, except
  296.    that one of the languages is Italian in the bootleg one instead of Spanish */
  297.  
  298. #define PORTS(GAMENAME, FOURTH_LANGUAGE)                                        \
  299.                                                                                 \
  300. INPUT_PORTS_START( GAMENAME## )                                        \
  301.     PORT_START    /* IN0 */                                                        \
  302.     /* The lower 4 bits and bit 7 are for trackball x input. */                    \
  303.     /* They are handled by fake input port 6 and a custom routine. */            \
  304.     PORT_BIT ( 0x0f, IP_ACTIVE_HIGH, IPT_UNKNOWN )                                \
  305.     PORT_DIPNAME(0x10, 0x00, DEF_STR( Cabinet ) )                                \
  306.     PORT_DIPSETTING (   0x00, DEF_STR( Upright ) )                                \
  307.     PORT_DIPSETTING (   0x10, DEF_STR( Cocktail ) )                                \
  308.     PORT_SERVICE( 0x20, IP_ACTIVE_LOW )                                            \
  309.     PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_VBLANK )                                \
  310.     PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )                                \
  311.                                                                                 \
  312.     PORT_START    /* IN1 */                                                        \
  313.     PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_START1 )                                \
  314.     PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_START2 )                                \
  315.     PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )                                \
  316.     PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )                    \
  317.     PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_TILT )                                    \
  318.     PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )                                    \
  319.     PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )                                    \
  320.     PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN3 )                                    \
  321.                                                                                 \
  322.     PORT_START    /* IN2 */                                                        \
  323.     PORT_ANALOGX( 0xff, 0x00, IPT_TRACKBALL_Y, 50, 10, 0, 0, IP_KEY_NONE, IP_KEY_NONE, IP_JOY_NONE, IP_JOY_NONE )  \
  324.     /* The lower 4 bits are the input, and bit 7 is the direction. */            \
  325.     /* The state of bit 7 does not change if the trackball is not moved.*/        \
  326.                                                                                 \
  327.     PORT_START    /* IN3 */                                                        \
  328.     PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )    \
  329.     PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )        \
  330.     PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )    \
  331.     PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )    \
  332.     PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )                \
  333.     PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )                \
  334.     PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )                \
  335.     PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )                \
  336.                                                                                 \
  337.     PORT_START    /* IN4 */                                                        \
  338.     PORT_DIPNAME(0x03, 0x00, "Language" )                                        \
  339.     PORT_DIPSETTING (   0x00, "English" )                                        \
  340.     PORT_DIPSETTING (   0x01, "German" )                                        \
  341.     PORT_DIPSETTING (   0x02, "French" )                                        \
  342.     PORT_DIPSETTING (   0x03, FOURTH_LANGUAGE )                                    \
  343.     PORT_DIPNAME(0x0c, 0x04, DEF_STR( Lives ) )                                    \
  344.     PORT_DIPSETTING (   0x00, "2" )                                                \
  345.     PORT_DIPSETTING (   0x04, "3" )                                                \
  346.     PORT_DIPSETTING (   0x08, "4" )                                                \
  347.     PORT_DIPSETTING (   0x0c, "5" )                                                \
  348.     PORT_DIPNAME(0x30, 0x10, DEF_STR( Bonus_Life ) )                            \
  349.     PORT_DIPSETTING (   0x00, "10000" )                                            \
  350.     PORT_DIPSETTING (   0x10, "12000" )                                            \
  351.     PORT_DIPSETTING (   0x20, "15000" )                                            \
  352.     PORT_DIPSETTING (   0x30, "20000" )                                            \
  353.     PORT_DIPNAME(0x40, 0x40, DEF_STR( Difficulty ) )                            \
  354.     PORT_DIPSETTING (   0x40, "Easy" )                                            \
  355.     PORT_DIPSETTING (   0x00, "Hard" )                                            \
  356.     PORT_DIPNAME(0x80, 0x00, "Credit Minimum" )                                    \
  357.     PORT_DIPSETTING (   0x00, "1" )                                                \
  358.     PORT_DIPSETTING (   0x80, "2" )                                                \
  359.                                                                                 \
  360.     PORT_START    /* IN5 */                                                        \
  361.     PORT_DIPNAME(0x03, 0x02, DEF_STR( Coinage ) )                                \
  362.     PORT_DIPSETTING (   0x03, DEF_STR( 2C_1C ) )                                \
  363.     PORT_DIPSETTING (   0x02, DEF_STR( 1C_1C ) )                                \
  364.     PORT_DIPSETTING (   0x01, DEF_STR( 1C_2C ) )                                \
  365.     PORT_DIPSETTING (   0x00, DEF_STR( Free_Play ) )                            \
  366.     PORT_DIPNAME(0x0c, 0x00, "Right Coin" )                                        \
  367.     PORT_DIPSETTING (   0x00, "*1" )                                            \
  368.     PORT_DIPSETTING (   0x04, "*4" )                                            \
  369.     PORT_DIPSETTING (   0x08, "*5" )                                            \
  370.     PORT_DIPSETTING (   0x0c, "*6" )                                            \
  371.     PORT_DIPNAME(0x10, 0x00, "Left Coin" )                                        \
  372.     PORT_DIPSETTING (   0x00, "*1" )                                            \
  373.     PORT_DIPSETTING (   0x10, "*2" )                                            \
  374.     PORT_DIPNAME(0xe0, 0x00, "Bonus Coins" )                                    \
  375.     PORT_DIPSETTING (   0x00, "None" )                                            \
  376.     PORT_DIPSETTING (   0x20, "3 credits/2 coins" )                                \
  377.     PORT_DIPSETTING (   0x40, "5 credits/4 coins" )                                \
  378.     PORT_DIPSETTING (   0x60, "6 credits/4 coins" )                                \
  379.     PORT_DIPSETTING (   0x80, "6 credits/5 coins" )                                \
  380.     PORT_DIPSETTING (   0xa0, "4 credits/3 coins" )                                \
  381.                                                                                 \
  382.     PORT_START    /* IN6, fake trackball input port. */                            \
  383.     PORT_ANALOGX( 0xff, 0x00, IPT_TRACKBALL_X | IPF_REVERSE, 50, 10, 0, 0, IP_KEY_NONE, IP_KEY_NONE, IP_JOY_NONE, IP_JOY_NONE )    \
  384. INPUT_PORTS_END
  385.  
  386. PORTS(centiped, "Spanish")
  387. PORTS(centipdb, "Italian")
  388.  
  389.  
  390. static struct GfxLayout charlayout =
  391. {
  392.     8,8,    /* 8*8 characters */
  393.     256,    /* 256 characters */
  394.     2,    /* 2 bits per pixel */
  395.     { 256*8*8, 0 },    /* the two bitplanes are separated */
  396.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  397.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  398.     8*8    /* every char takes 8 consecutive bytes */
  399. };
  400. static struct GfxLayout spritelayout =
  401. {
  402.     8,16,    /* 16*8 sprites */
  403.     128,    /* 64 sprites */
  404.     2,    /* 2 bits per pixel */
  405.     { 128*16*8, 0 },    /* the two bitplanes are separated */
  406.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  407.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  408.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  409.     16*8    /* every sprite takes 16 consecutive bytes */
  410. };
  411.  
  412.  
  413.  
  414. static struct GfxDecodeInfo gfxdecodeinfo[] =
  415. {
  416.     { REGION_GFX1, 0, &charlayout,   4, 4 },    /* 4 color codes to support midframe */
  417.                                                 /* palette changes in test mode */
  418.     { REGION_GFX1, 0, &spritelayout, 0, 1 },
  419.     { -1 } /* end of array */
  420. };
  421.  
  422.  
  423.  
  424. static struct POKEYinterface pokey_interface =
  425. {
  426.     1,    /* 1 chip */
  427.     12096000/8,    /* 1.512 MHz */
  428.     { 100 },
  429.     /* The 8 pot handlers */
  430.     { 0 },
  431.     { 0 },
  432.     { 0 },
  433.     { 0 },
  434.     { 0 },
  435.     { 0 },
  436.     { 0 },
  437.     { 0 },
  438.     /* The allpot handler */
  439.     { 0 },
  440. };
  441.  
  442. static struct AY8910interface centipdb_ay8910_interface =
  443. {
  444.     1,    /* 1 chips */
  445.     12096000/8,    /* 1.512 MHz */
  446.     { 50 },
  447.     { 0 },
  448.     { 0 },
  449.     { 0 },
  450.     { 0 }
  451. };
  452.  
  453. static struct AY8910interface centipb2_ay8910_interface =
  454. {
  455.     1,    /* 1 chips */
  456.     12096000/8,    /* 1.512 MHz */
  457.     { 50 },
  458.     { centipdb_rand_r },
  459.     { 0 },
  460.     { 0 },
  461.     { 0 }
  462. };
  463.  
  464.  
  465. #define DRIVER(GAMENAME, SOUND_TYPE, SOUND_INTERFACE)                            \
  466.                                                                                 \
  467. static struct MachineDriver machine_driver_##GAMENAME =                            \
  468. {                                                                                \
  469.     /* basic machine hardware */                                                \
  470.     {                                                                            \
  471.         {                                                                        \
  472.             CPU_M6502,                                                            \
  473.             12096000/8,    /* 1.512 Mhz (slows down to 0.75MHz while accessing playfield RAM) */    \
  474.             GAMENAME##_readmem,GAMENAME##_writemem,0,0,                            \
  475.             centiped_interrupt,4                                                \
  476.         }                                                                        \
  477.     },                                                                            \
  478.     60, 1460,    /* frames per second, vblank duration */                        \
  479.     1,    /* single CPU, no need for interleaving */                                \
  480.     centiped_init_machine,                                                        \
  481.                                                                                 \
  482.     /* video hardware */                                                        \
  483.     32*8, 32*8, { 0*8, 32*8-1, 0*8, 30*8-1 },                                    \
  484.     gfxdecodeinfo,                                                                \
  485.     4+4*4, 4+4*4,                                                                \
  486.     0,                                                                            \
  487.                                                                                 \
  488.     VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY|VIDEO_MODIFIES_PALETTE,                \
  489.     0,                                                                            \
  490.     generic_vh_start,                                                            \
  491.     generic_vh_stop,                                                            \
  492.     centiped_vh_screenrefresh,                                                    \
  493.                                                                                 \
  494.     /* sound hardware */                                                        \
  495.     0,0,0,0,                                                                    \
  496.     {                                                                            \
  497.         {                                                                        \
  498.             SOUND_TYPE,                                                            \
  499.             SOUND_INTERFACE,                                                    \
  500.         }                                                                        \
  501.     },                                                                            \
  502.                                                                                 \
  503.     atari_vg_earom_handler                                                        \
  504. };
  505.  
  506.  
  507. DRIVER(centiped, SOUND_POKEY, &pokey_interface)
  508.  
  509. /* In the bootlegs the Pokey has been replaced by an AY8910 */
  510. DRIVER(centipdb, SOUND_AY8910, ¢ipdb_ay8910_interface)
  511. DRIVER(centipb2, SOUND_AY8910, ¢ipb2_ay8910_interface)
  512.  
  513.  
  514. /***************************************************************************
  515.  
  516.   Game driver(s)
  517.  
  518. ***************************************************************************/
  519.  
  520. ROM_START( centiped )
  521.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  522.     ROM_LOAD( "centiped.307", 0x2000, 0x0800, 0x5ab0d9de )
  523.     ROM_LOAD( "centiped.308", 0x2800, 0x0800, 0x4c07fd3e )
  524.     ROM_LOAD( "centiped.309", 0x3000, 0x0800, 0xff69b424 )
  525.     ROM_LOAD( "centiped.310", 0x3800, 0x0800, 0x44e40fa4 )
  526.     ROM_RELOAD(               0xf800, 0x0800 )    /* for the reset and interrupt vectors */
  527.  
  528.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  529.     ROM_LOAD( "centiped.211", 0x0000, 0x0800, 0x880acfb9 )
  530.     ROM_LOAD( "centiped.212", 0x0800, 0x0800, 0xb1397029 )
  531. ROM_END
  532.  
  533. ROM_START( centipd2 )
  534.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  535.     ROM_LOAD( "centiped.207", 0x2000, 0x0800, 0xb2909e2f )
  536.     ROM_LOAD( "centiped.208", 0x2800, 0x0800, 0x110e04ff )
  537.     ROM_LOAD( "centiped.209", 0x3000, 0x0800, 0xcc2edb26 )
  538.     ROM_LOAD( "centiped.210", 0x3800, 0x0800, 0x93999153 )
  539.     ROM_RELOAD(               0xf800, 0x0800 )    /* for the reset and interrupt vectors */
  540.  
  541.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  542.     ROM_LOAD( "centiped.211", 0x0000, 0x0800, 0x880acfb9 )
  543.     ROM_LOAD( "centiped.212", 0x0800, 0x0800, 0xb1397029 )
  544. ROM_END
  545.  
  546. ROM_START( centipdb )
  547.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  548.     ROM_LOAD( "olympia.c28",  0x2000, 0x0800, 0x8a744e57 )
  549.     ROM_LOAD( "olympia.c29",  0x2800, 0x0800, 0xbb897b10 )
  550.     ROM_LOAD( "olympia.c30",  0x3000, 0x0800, 0x2297c2ac )
  551.     ROM_LOAD( "olympia.c31",  0x3800, 0x0800, 0xcc529d6b )
  552.     ROM_RELOAD(               0xf800, 0x0800 )    /* for the reset and interrupt vectors */
  553.  
  554.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  555.     ROM_LOAD( "olympia.c32",  0x0000, 0x0800, 0xd91b9724 )
  556.     ROM_LOAD( "olympia.c33",  0x0800, 0x0800, 0x1a6acd02 )
  557. ROM_END
  558.  
  559. ROM_START( centipb2 )
  560.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  561.     ROM_LOAD( "d1",            0x2000, 0x0800, 0xb17b8e0b )
  562.     ROM_LOAD( "e1",            0x2800, 0x0800, 0x7684398e )
  563.     ROM_LOAD( "h1",            0x3000, 0x0800, 0x74580fe4 )
  564.     ROM_LOAD( "j1",            0x3800, 0x0800, 0x84600161 )
  565.     ROM_RELOAD(               0xf800, 0x0800 )    /* for the reset and interrupt vectors */
  566.     ROM_LOAD( "k1",            0x6000, 0x0800, 0xf1aa329b )
  567.  
  568.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  569.     ROM_LOAD( "centiped.211", 0x0000, 0x0800, 0x880acfb9 )
  570.     ROM_LOAD( "centiped.212", 0x0800, 0x0800, 0xb1397029 )
  571. ROM_END
  572.  
  573.  
  574. GAME( 1980, centiped, 0,        centiped, centiped, 0, ROT270, "Atari", "Centipede (revision 3)" )
  575. GAME( 1980, centipd2, centiped, centiped, centiped, 0, ROT270, "Atari", "Centipede (revision 2)" )
  576. GAME( 1980, centipdb, centiped, centipdb, centipdb, 0, ROT270, "bootleg", "Centipede (bootleg set 1)" )
  577. GAME( 1980, centipb2, centiped, centipb2, centiped, 0, ROT270, "bootleg", "Centipede (bootleg set 2)" )
  578.